﻿using System.Collections.ObjectModel;
using System.Windows;
using System;
using Automator.Classes;

namespace Automator.Windows
{
    /// <summary>
    /// Interaction logic for SaveChangesWindow.xaml
    /// </summary>
    public partial class SaveChangesWindow : Window
    {
        private ObservableCollection<string> changedDocs = new ObservableCollection<string>();
        private WindowShowResult result = WindowShowResult.Cancel;

        public SaveChangesWindow()
        {
            InitializeComponent();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            btnYes.Click += delegate { result = WindowShowResult.Yes; this.DialogResult = true; Close(); };
            btnNo.Click += delegate { result = WindowShowResult.No; this.DialogResult = true; Close(); };
            btnCancel.Click += delegate { result = WindowShowResult.Cancel; this.DialogResult = true; Close(); };
            lstChanged.ItemsSource = changedDocs;
        }

        public void AddChangedDocument(string value)
        {
            changedDocs.Add(value.Replace("*", String.Empty));
        }

        public int ChangedCount
        {
            get { return changedDocs.Count; }
        }

        public WindowShowResult Result
        {
            get { return result; }
        }
    }
}
